package me.leiusual.sharing.ui.order.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.view_holder_order_logistics.*
import me.leiusual.sharing.api.model.OrderLogistics
import me.leiusual.sharing.util.extension.toSpanned

/**
 * author: leiusual
 * create on: 2019-08-11
 * description:
 */
class OrderLogisticsViewHolder(
    override val containerView: View
) : RecyclerView.ViewHolder(containerView), LayoutContainer {

  fun bind(data: OrderLogistics.Response.RealLogistics.Data) {

    val builder = StringBuilder()
    builder.append(data.AcceptTime)
    builder.append("""<br/>${data.AcceptStation}""")
    if (data.Remark != null) {
      builder.append("""<br/>${data.Remark}""")
    }
    text_view.text = builder.toString().toSpanned()
  }
}